import { Redirect } from 'react-router-dom'
import { getItem } from './storage'
import React from 'react'
export default function randerRoutes(
  Component: React.ComponentType,
  location: { pathname: string }
) {
  return getItem().token ? (
    <Component></Component>
  ) : (
    <Redirect to={{ pathname: '/login', state: { from: location.pathname } }} />
  )
}
